import request from '@/utils/request'

// 批量下载
export function batchDownload(data) {
  return request({
    url: '/download/batch',
    method: 'post',
    data,
    headers: {
      'X-Client-Id': generateClientId()
    }
  })
}

// 生成客户端ID
function generateClientId() {
  return Math.random().toString(36).substr(2, 16)
}

// 单个文件下载
export function downloadMaterial(id) {
  return request({
    url: `/download/${id}`,
    method: 'get'
  })
}